<script language="javascript" src="<?=ROOT_PATH?>/html/scripts/administrator/validate_product.js"></script>

<script>

upload.type='product';

upload.formid='addProductForm';

fenleiEffection.type='product';

fenleiEffection.optionString='请选择产品分类';
function move(obj){
	if(obj==''){
		return;
	}
	var oList1=document.getElementById("oListbox1");
	var oList2=document.getElementById("oListbox2");
	var price =document.getElementById("price");
	var arrOptions=new Array;
	if(obj=="add"){
		if(oList1.options.length<=0){
			alert("左边已经没有了");
			return;
		}
	if(oList1.selectedIndex<0)

{

alert("请选择要删除的项");

return;

}

for(var i=0;i<oList1.options.length;i++){
	if(oList1.options[i].selected){
		//将当前选中的添加到数组中
		if(price.value.length<=0){
			alert("请填写价格");
			return;
		}
		oList1.options[i].text = oList1.options[i].text +"%%%"+price.value;
		oList1.options[i].value = oList1.options[i].value +"%%%"+price.value;
		arrOptions.push(oList1.options[i]);
	}
}

for(var i=0;i<arrOptions.length;i++){
	//循环把数组中的值添加的oList2
	oList2.appendChild(arrOptions[i]);
}

}

else if(obj=="delete")

{

if(oList2.options.length<=0)

{

alert("右边已经没有了");

return;

}

if(oList2.selectedIndex<0)

{

alert("请选择要删除的项");

return;

}

for(var i=0;i<oList2.options.length;i++)

{

if(oList2.options[i].selected){
	oList2.options[i].text = oList2.options[i].text.substring(0,oList2.options[i].text.indexOf("%%%"));
	oList2.options[i].value = oList2.options[i].value.substring(0,oList2.options[i].value.indexOf("%%%"));
	arrOptions.push(oList2.options[i]);

}

}

for(var i=0;i<arrOptions.length;i++)

{

oList1.appendChild(arrOptions[i]);

}

}

}

</script>

<div class="frame_addProductDiv">

	<form id="addProductForm" method="post" enctype="multipart/form-data" action="administrator-product-doadd">

	  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">

		<tr>

		  <td colspan="2" class="se" style="text-align:left">

		  <img src="html/images/administrator/add_product_item.jpg" /> <img src="html/images/administrator/product_1.gif" /> <strong>产品基本信息</strong>

		  </td>

		</tr>

		<tr>

		  <td valign="top" class="ri-bbgg"><span class="red">*</span> 产品分类： </td>

		  <td class="le">

		  	<div>

			<select id="flSelect" onchange="fenleiEffection.getChildFenlei(this);">

				<option value="0">请选择产品分类</option>

				<?for($i=0;$i<count($this->fenleiArray);$i++):?>

				<option value="<?=$this->fenleiArray[$i]['flid']?>"><?=$this->fenleiArray[$i]['flname']?></option>

				<?endfor;?>

			</select>

			</div>

			<div><input id="flid" name="flid" type="hidden" /></div>

		  </td>

		</tr>

		<!-- <tr>

		  <td valign="top" class="ri-bbgg"><span class="red"></span> 指定臂章： </td>

		  <td class="le">
			<?php foreach ($this->badges as $k=>$badge):?>
			<input type="checkbox" name="select_badgepatch_p[]" id="select_badgepatch_p_<?=$k?>" value="<?=trim($badge['name'])?>|<?php echo $badge['img']?>" /><label for="select_badgepatch_p_<?=$k?>"><?=trim($badge['name'])?><img src="<?php echo $badge['img']?>" width="50" height="50" /></label><br />
			<?php endforeach;?>
		  </td>

		</tr> -->

		<!-- <tr>

		  <td valign="top" class="ri-bbgg"><span class="red"></span> 产品库存： </td>

		  <td class="le">
			<input type="text" name="stock" value="1000" />
		  </td>

		</tr> -->

		<tr>

		  <td class="ri-bbgg"><span class="red">*</span> 产品名称：</td>

		  <td class="le">

		  	<div><input name="subject"  type="text" id="subject" value="" size="100" maxlength="100" /></div>

			<div></div>

			<div>产品名称中需要含有产品品牌、型号、功能等关键字，以备买家搜索到，<br />如Brand New Nikon D70 6.1 Megapixel digital SLR camera body only（产品名必须为英文）。</div>

		  </td>

		</tr>

          <tr>

		  <td class="ri-bbgg"><span class="red">*</span> seo关键词：</td>

		  <td class="le">

		  	<div><input name="keywords" type="text" id="keywords" size="60" /></div>

			<div></div>

			<div>词与词之间用","逗好分间</div>

		  </td>

		</tr>

        <tr>

		  <td class="ri-bbgg"><span class="red">*</span> seo描述：</td>

		  <td class="le">

		  	<div>

		  	  <textarea name="description" cols="60" rows="5" id="description"></textarea>

		  	</div>

			<div></div>

			<div>在100字以内</div>

		  </td>

		</tr>
		<tr>

		  <td class="ri-bbgg"><span class="red">*</span> seo url 描述：</td>

		  <td class="le">

		  	<div><input name="slug" type="text" id="slug" size="60" /></div>

			<div></div>

			<div>词与词之间用"-"分间</div>

		  </td>

		</tr>
		<tr>

		  <td class="ri-bbgg"> 赞助商LOGO：</td>

		  <td class="le">

				<select name="product_sponsors">

					<option value="" >无</option>

					<?for($i=0;$i<count($this->sponsorsArray);$i++):?>

				<option value="<?=$this->sponsorsArray[$i]['cut_url']?>"><?=$this->sponsorsArray[$i]['carrier']?></option>

			    	<?endfor;?>

				</select> 

				

				赞助商LOGO制作方式:

				<select name="product_brandlogo">

					<option value="" >无</option>

					<?for($i=0;$i<count($this->brandlogoArray);$i++):?>

				<option value="<?=$this->brandlogoArray[$i]['carrier']?>"><?=$this->brandlogoArray[$i]['carrier']?></option>

			    	<?endfor;?>

				</select>

				队标制作方式:

				<select name="product_teambadge">

					<option value="" >无</option>

					<?for($i=0;$i<count($this->brandlogoArray);$i++):?>

				<option value="<?=$this->brandlogoArray[$i]['carrier']?>"><?=$this->brandlogoArray[$i]['carrier']?></option>

			    	<?endfor;?>

				</select>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg">产品规格说明：</td>

		  <td class="le">

		  	<div><textarea name="pattern_intro" style="width:500px;height:100px"></textarea></div>

			<div></div>

			<div>(选填)请用英文填写，对产品名称中不能体现的产品参数信息的补充，一般需要含有关于颜色、尺寸、款式、配件、贸易方式等的关键字，以备买家搜索到。</div>

		  </td>

		</tr>

		<tr style="display:none">

		  <td class="ri-bbgg"><span class="red">*</span> 产品所在地区：</td>

		  <td class="le">

		  	<script>locationFl.inputid='location_id';</script>

		  	<div>

				<select id="locationSelect" onchange="locationFl.getChildFenlei(this);">

					<option value="0">请选择地区</option>

					<?for($i=0;$i<count($this->locationArray);$i++):?>

					<option value="<?=$this->locationArray[$i]['flid']?>"><?=$this->locationArray[$i]['flname']?></option>

					<?endfor;?>

				</select>

			</div>

			<input type="hidden" value="0" id="location_id" name="location_id" />

		  </td>

		</tr>

	  </table>

	  <br />

	  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">

		<tr>

		  <td colspan="2" class="se" style="text-align:left">

		  <img src="html/images/administrator/add_product_item.jpg" /> <img src="html/images/administrator/product_2.gif" /> <strong>产品图片信息</strong>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg"><span class="red">*</span> 上传产品图片：</td>

		  <td class="le"><span><input name="productpic" type="file" id="productpic" /></span>　<input type="button" onclick="upload.uploadimg(this);" value="上传" />　( 可连续上传多幅 )</td>

		</tr>

		<tr>

		  <td class="ri-bbgg">产品图片效果：</td>

		  <td class="le">

		  	<div id="productImages"></div>

			<iframe id="productIframe" width="0" height="0" name="productIframe"></iframe>

		  </td>

		</tr>

	  </table>

	  <br />

	  <table style="display:none" width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">

		<tr>

		  <td colspan="2" class="se" style="text-align:left">

		  <img src="html/images/administrator/add_product_item.jpg" /> <img src="html/images/administrator/product_3.gif" /> <strong>产品有效期</strong>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg"><span class="red">*</span> 产品有效期：</td>

		  <td class="le">

		  	<input type="radio" name="valid_days"  value="7"   />7天 

        	<input type="radio" name="valid_days"  value="14"  />14天 

        	<input type="radio" name="valid_days"  value="30" checked="checked" />一个月  

			<input type="radio" name="valid_days"  value="90" />三个月

		  </td>

		</tr>

	  </table>

	  <br />

	  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">

		<tr>

		  <td colspan="2" class="se" style="text-align:left">

		  <img src="html/images/administrator/add_product_item.jpg" /> <img src="html/images/administrator/product_4.gif" /> <strong>产品详细描述</strong>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg"><span class="red">*</span> 产品详细描述：</td>

		  <td class="le">

		  	<div>产品详细信息展示以及相关产品推荐等。如产品配件、附加服务、其他同类产品展示等。</div>

			<div><?=$this->oFCKeditor->Create();?></div>

			<div></div>

		  </td>

		</tr>
		
		<tr>

		  <td class="ri-bbgg"><span class="red">*</span> 产品详细描述图片：</td>

		  <td class="le">
		  	<span><input name="despic[]" type="file" onchange="upload.addparm(this)"/><br/><br/></span>
		  	<div><input type="button" onclick="upload.uploadimgmul(this,0);" value="上传" /></div>
		  </td>

		</tr>
		<tr>

		  <td class="ri-bbgg">产品描述图片效果：</td>

		  <td class="le">
		  	<div id="desImages">				
			</div>
		  </td>

		</tr>

	  </table>

	  <!--

	  <br />

	  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">

		<tr>

		  <td colspan="2" class="se" style="text-align:left">

		  <img src="html/images/administrator/add_product_item.jpg" /> <img src="html/images/administrator/product_5.gif" /> <strong>产品运输设置</strong>

		  </td>

		</tr>

		<tr>

		  <td align="center">选择您所支持的运输方式</td>

		  <td class="le" align="center">定义运费</td>

		</tr>

		<tr>

		  <td class="ri-bbgg" style="width:50%;text-align:center"><input type="checkbox" name="ups_checkbox" /> UPS</td>

		  <td class="le" align="center">

		  	<div><input type="radio" value="" name="ups_radio" checked="checked" /> 标准运费　<input type="radio" value="" name="ups_radio" /> 自定义运费 </div>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg" style="width:50%;text-align:center"><input type="checkbox" name="dhl_checkbox" /> DHL</td>

		  <td class="le" align="center">

		  	<div><input type="radio" value="" name="dhl_radio" checked="checked" /> 标准运费　<input type="radio" value="" name="dhl_radio" /> 自定义运费 </div>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg" style="width:50%;text-align:center"><input type="checkbox" name="ems_checkbox" /> EMS</td>

		  <td class="le" align="center">

		  	<div><input type="radio" value="" name="ems_radio" checked="checked" /> 标准运费　<input type="radio" value="" name="ems_radio" /> 自定义运费 </div>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg" style="width:50%;text-align:center"><input type="checkbox" name="tnt_checkbox" /> TNT</td>

		  <td class="le" align="center">

		  	<div><input type="radio" value="" name="tnt_radio" checked="checked" /> 标准运费　<input type="radio" value="" name="tnt_radio" /> 自定义运费 </div>

		  </td>

		</tr>

	  </table>

	  -->

	  <br />

	  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">

		<tr>

		  <td colspan="2" class="se" style="text-align:left">

		  <img src="html/images/administrator/add_product_item.jpg" /> <img src="html/images/administrator/product_6.gif" /> <strong>产品包装信息</strong>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg"><span class="red">*</span> 选择包装：</td>

		  <td class="le">

		  	<div><input onclick="commonEffection.changePackSell(0,this);"  type="radio" value="1" name="is_single" checked="checked" /><label> 单件卖　</label><input onclick="commonEffection.changePackSell(1,this);" type="radio" value="0" name="is_single" /><label> 论包卖</label></div>

			<div>请根据产品价值和重量等，选择单件出售或打包出售商品。</div>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg"><span class="red">*</span> 单件产品单位：</td>

		  <td class="le">

		  	<div>

				<select name="unit">

					<option value="Piece" >Piece</option>

					<option value="Dozen" >Dozen</option>

					<option value="Feet" >Feet</option>

					<option value="Set" >Set</option>

					<option value="Gram" >Gram</option>

					<option value="Gallon (US)" >Gallon (US)</option>

					<option value="Gallon (UK)" >Gallon (UK)</option>

					<option value="Inch" >Inch</option>

					<option value="Kilogram" >Kilogram</option>

					<option value="Kilometre" >Kilometre</option>

					<option value="Liter" >Liter</option>

					<option value="Metric Tonne" >Metric Tonne</option>

					<option value="Meter" >Meter</option>

					<option value="Millimeter" >Millimeter</option>

					<option value="Milliliter" >Milliliter</option>

					<option value="Ounce" >Ounce</option>

					<option value="Pair" >Pair</option>

					<option value="Pound" >Pound</option>

					<option value="Pint (US)" >Pint (US)</option>

					<option value="Pint (UK)" >Pint (UK)</option>

					<option value="Quart" >Quart</option>

					<option value="Square Yard" >Square Yard</option>

					<option value="Square Meter" >Square Meter</option>

					<option value="Square Feet" >Square Feet</option>

					<option value="Square Inch" >Square Inch</option>

					<option value="Ton (US)" >Ton (US)</option>

					<option value="Ton (UK)" >Ton (UK)</option>

					<option value="Yard" >Yard</option>

					<option value="Centimeter" >Centimeter</option>

					<option value="Pieces/Color" >Pieces/Color</option>

					<option value="Meter/Colour" >Meter/Colour</option>

					<option value="Square foot" >Square foot</option>

					<option value="Cartoon" >Cartoon</option>

				</select>

			</div>

			<div>每一个产品都有单位，请选择合适的单位描述您的产品。</div>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg"> 产品包装尺寸：</td>

		  <td class="le">

		  	<div><input type="text" value="0" name="size1" /> cm　<input type="text" value="0" name="size2" /> cm　<input type="text" value="0" name="size3" /> cm</div>

			<div>请填入对应的数字尺寸值，系统就根据您填的值自动计算国际运费，<br />所以请务必填写准确单位为厘米。(长 * 宽 * 高)cm </div>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg"><span class="red">*</span> 产品包装毛重：</td>

		  <td class="le">

		  	<div><input type="text" value="" name="weight" /> 公斤</div>

			<div>产品包装后的重量。 <a target="_blank" href="buyer-express-index?lang=cn">计算运费</a></div>

		  </td>

		</tr>

	  </table>

	  <br />

	  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">

		<tr>

		  <td colspan="7" class="se" style="text-align:left">

		  	<img src="html/images/administrator/add_product_item.jpg" /> <img src="html/images/administrator/product_8.gif" /> <strong>产品价格</strong>

		  </td>

		</tr>

		<tr>

		  <td class="ri-bbgg" style="width:15%;text-align:center">产品特征/规格<br />（可留空）</td>

		  <td class="ri-bbgg" style="width:15%;text-align:center">最小采购量</td>

		  <td class="ri-bbgg" style="width:15%;text-align:center">最大采购量</td>

		  <td class="ri-bbgg" style="width:15%;text-align:center">供应商价<br />（美元）</td>

		  <td class="ri-bbgg" style="width:15%;text-align:center">网上销售价格<br />（美元）</td>

		  <td class="ri-bbgg" style="width:15%;text-align:center">生产交货天数</td>

		  <td class="ri-bbgg" style="width:8%;text-align:center">删除</td>

		</tr>

		<tr>

		  <td class="le" style="text-align:center"><input type="text" name="pattern_name[]" value="item" style="width:80px;" /></td>

		  <td class="le" style="text-align:center"><input type="text" name="min_counts[]" style="width:80px;" /></td>

		  <td class="le" style="text-align:center"><input type="text" name="max_counts[]" style="width:80px;" /></td>

		  <td class="le" style="text-align:center"><input type="text" name="supply_price[]" style="width:80px;" /></td>

		  <td class="le" style="text-align:center"><input type="text" readonly="readonly" name="net_price[]" style="width:80px;color:#999999" /></td>

		  <td class="le" style="text-align:center"><input type="text" name="delivery_days[]" style="width:80px;" /></td>

		  <td class="le" style="text-align:center"><input type="button" value="删除" /></td>

		</tr>

		<tr>

		  <td colspan="7" class="se" style="text-align:left">

		  <!--<input type="button" style="width:130px" onclick="commonEffection.addPattern(this);" value="添加产品特征/规格" />-->　<input style="width:105px" type="button" onclick="commonEffection.addPrice(this);" value="添加产品价格" />

		  </td>

		</tr>

		<tr>

		  <td colspan="7" class="se">

		  	<div>规格大小: <input type="button" onclick="addPatternSize(this);" value="添加" /></div>

			<div><input name="pattern_size[]" value="48 (M)" /> 库存：<input name="pattern_size_stock[]" value="0"></input> <input type="button" onclick="deletePatternSize(this);" value="删除" /></div>

			<div><input name="pattern_size[]" value="50 (L)" /> 库存：<input name="pattern_size_stock[]" value="0"></input> <input type="button" onclick="deletePatternSize(this);" value="删除" /></div>

			<div><input name="pattern_size[]" value="52 (XL)" /> 库存：<input name="pattern_size_stock[]" value="0"></input> <input type="button" onclick="deletePatternSize(this);" value="删除" /></div>

			<div><input name="pattern_size[]" value="54 (XXL)" /> 库存：<input name="pattern_size_stock[]" value="0"></input> <input type="button" onclick="deletePatternSize(this);" value="删除" /></div>

			

		  </td>

		</tr>
		<tr>

		  <td colspan="7" class="se" style="text-align:left">

		  <img src="html/images/administrator/add_product_item.jpg" /> <img src="html/images/administrator/product_9.gif" /> <strong>添加配件</strong>

		  </td>

		</tr>
		<tr>

		  <td colspan="7" class="se" style="text-align:left">



  <table width="460" border="0" class="zhcx" cellpadding="0" cellspacing="0">

    <tr>

      <td><select name="oListbox1" size="18" style="width:360px;" multiple="multiple" id="oListbox1">

          <?for($i=0;$i<count($this->accessoryProductArray);$i++):?>

          <option value="<?=$this->accessoryProductArray[$i]['itemid']?>"><?=$this->accessoryProductArray[$i]['subject']?></option>

          <?endfor;?>

        </select>

      </td>
      

      <td> &nbsp;$<input type="text" size=5 class="zhcxbtn" name="price" id="price">
      <br>
      &nbsp;<input type="button" class="zhcxbtn" value=" &gt; " onclick="move('add');selectAll();"/>&nbsp;

        <br />

        &nbsp;<input type="button" class="zhcxbtn" value=" &lt; " onclick="move('delete');selectAll();"/> &nbsp;

      </td>

      <td>
      <select name="interrelated[]" size="18" style="width:360px;" multiple="multiple" id="oListbox2"></select>

      </td>

      <td>

      </td>

    </tr>

  </table>

		  </td>

		</tr>

	  </table>

	  <br />

	  <div class="addProductSubmit"><input onclick="checkProduct()" type="button" value="提交" />　 <input type="button" onclick="commonEffection.confirmBack()" value="返回" /></div>

  </form>

</div>

<script>

	function checkProduct(){

		productCommonCheck.checkAll()

	}

	function addPatternSize(thisInput){

		$(thisInput).parent().parent().append('<div><input name="pattern_size[]" /> 库存：<input name="pattern_size_stock[]" value="0"></input> <input type="button" onclick="deletePatternSize(this);" value="删除" /></div>');

		commonEffection.resetFrame('admins_frame',true);

	}

	function deletePatternSize(thisInput){

		$(thisInput).parent().remove();

		commonEffection.resetFrame('admins_frame',true);

	}

</script>